# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.db import models


# Create your models here.
class LackBus(models.Model):
    id = models.BigAutoField(primary_key=True)
    comp = models.CharField(max_length=50, verbose_name='营运企业')
    op_date = models.DateField(verbose_name='营运日期')
    seq = models.IntegerField(verbose_name='序号')
    line = models.CharField(max_length=10, verbose_name='线路', null=True)
    word_track = models.CharField(max_length=10, verbose_name='字轨', null=True)
    plate = models.CharField(max_length=10, verbose_name='车牌号或自编号', null=True)
    bus_type = models.CharField(max_length=20, verbose_name='车辆类型', null=True)
    plate_v2 = models.CharField(max_length=10, verbose_name='支援车号', null=True)
    start_time = models.TimeField(max_length=25, verbose_name='起始时间', null=True)
    end_time = models.TimeField(max_length=25, verbose_name='结束时间', null=True)
    situation = models.CharField(max_length=100, verbose_name='行驶中出现的情况', null=True)
    station = models.CharField(max_length=20, verbose_name='发生站点', null=True)
    lack_trip_num = models.FloatField(verbose_name='缺单数', null=True)
    sup_trip_num = models.FloatField(verbose_name='支援单数', null=True)
    total_lack_trip_num = models.FloatField(verbose_name='总计缺单数', null=True)
    lack_bus_start_time = models.CharField(max_length=20, verbose_name='缺单具体发车时间', null=True)
    sup_bus_start_time = models.CharField(max_length=20, verbose_name='支援车具体发车时间', null=True)
    submit_date = models.DateField(verbose_name='上报日期', null=True)
    category = models.CharField(max_length=50, verbose_name='类别', null=True)
    type = models.CharField(max_length=20, verbose_name='类型', null=True)

    def __str__(self):
        return "企业:{} 营运日期:{} 编号：{} 线路：{} 车牌号：{} 起始时间：{} 结束时间：{}".format(
            self.comp, self.op_date, self.seq,
            self.line, self.plate, self.start_time, self.end_time)

    class Meta:
        verbose_name = '非正常营运情况'
        verbose_name_plural = '非正常营运情况'